<?php
namespace app\controller;

use app\service\GoodsService;
use app\BaseController;
use app\service\CategoryService;
use think\App;
use think\facade\View;

class Nine extends BaseController
{
    protected $categoryService;
    protected $goodsService;

    /**
     * Category constructor.
     * @param App $app
     */
    public function __construct(App $app)
    {
        parent::__construct($app);
        $this->categoryService = app()->make(CategoryService::class);
        $this->goodsService = app()->make(GoodsService::class);
    }

    public function index(): string
    {
        $detail['type'] = 'nine';
        $detail['name'] = '九块九包邮';
        $data['detail'] = $detail;
        $page = $this->goodsService->queryListByPage('actual_price < 10', 'coupon_price desc',20);
        $data['pageInfo'] = $page['page'];
        $data['list'] = $page['data'];
        $data['page'] = $this->request->get('page');
        $data['brandList'] = $this->goodsService->queryListByNum('brand_id > 0', 'commission_rate desc',5);
        return View::fetch('/goods/index', $data);
    }
}
